﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToPLMX.SimulationStateExporter.CApExportToPlmxStateModificationObjectExporter
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension.ObjectsStateExportService;
using System.Collections.Generic;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ExportToPLMX.SimulationStateExporter;

internal class CApExportToPlmxStateModificationObjectExporter : ITxStateModificationObjectExporterEx
{
  private ITxObject m_obj;

  public CApExportToPlmxObjectStateData ObjectStateData { get; set; } = new CApExportToPlmxObjectStateData();

  public CApExportToPlmxStateModificationObjectExporter(ITxObject obj, int index)
  {
    this.m_obj = obj;
    this.ObjectStateData.i = index;
  }

  public void End()
  {
  }

  public void ExportHumanPosture()
  {
  }

  public void ExportPosition()
  {
    if (!(this.m_obj is ITxLocatableObject itxLocatableObject1))
      return;
    ITxLocatableObject itxLocatableObject2 = (ITxLocatableObject) null;
    if (!(this.m_obj is TxPhysicalRoot))
      itxLocatableObject2 = itxLocatableObject1.PrimaryLocator as ITxLocatableObject;
    TxTransformation txTransformation = itxLocatableObject2 == null ? itxLocatableObject1.AbsoluteLocation : itxLocatableObject1.GetLocationRelativeToObject(itxLocatableObject2);
    TxVector rotationRpyXyz = txTransformation.RotationRPY_XYZ;
    TxVector translation = txTransformation.Translation;
    this.ObjectStateData.tx = new double?(translation.X);
    this.ObjectStateData.ty = new double?(translation.Y);
    this.ObjectStateData.tz = new double?(translation.Z);
    this.ObjectStateData.rx = new double?(rotationRpyXyz.X);
    this.ObjectStateData.ry = new double?(rotationRpyXyz.Y);
    this.ObjectStateData.rz = new double?(rotationRpyXyz.Z);
  }

  public void ExportVisibility()
  {
    if (!(this.m_obj is ITxDisplayableObject displayableObject))
      return;
    TxDisplayableObjectVisibility visibility = displayableObject.Visibility;
    if (visibility != null)
    {
      if (visibility != 2)
        return;
      this.ObjectStateData.v = new int?(0);
    }
    else
      this.ObjectStateData.v = new int?(1);
  }

  public void Start()
  {
  }

  public void ExportEmphasize()
  {
  }

  public void ExportItemCreated()
  {
  }

  public void ExportItemAdded()
  {
  }

  public void ExportExternalApplicationItemSync()
  {
  }

  public void ExportAttributeChanged(string attributeName, List<string> modifications)
  {
  }
}
